package com.atguigu.config;


import com.atguigu.pojo.Animal;
import com.atguigu.pojo.Monkey;
import com.atguigu.pojo.Tiger;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyConfiguration {

    @Bean("animal")
    @ConditionalOnProperty(name="com.atguigu.animal.type",havingValue = "T")
    public Animal createAnimal01(){
        return new Tiger();
    }

    @Bean("animal")
    @ConditionalOnProperty(name="com.atguigu.animal.type",havingValue = "M")
    public Animal createAnimal02(){
        return new Monkey();
    }


}
